<form id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
    <input type="hidden" name="row[source_id]" value="{$source_id}"/>
    <input type="hidden" name="row[source]" value="{$source}"/>
    <div class="form-group">
        <label for="c-name" class="control-label col-xs-12 col-sm-2">{:__('Name')}:</label>
        <div class="col-xs-12 col-sm-4">
            <input id="c-name" data-rule="required" class="form-control" name="row[name]" type="text" placeholder="仅支持字母、数字、下划线">
        </div>
    </div>
    <div class="form-group">
        <label for="c-title" class="control-label col-xs-12 col-sm-2">{:__('Title')}:</label>
        <div class="col-xs-12 col-sm-4">
            <input id="c-title" data-rule="required" class="form-control" name="row[title]" type="text">
        </div>
    </div>
    <div class="form-group">
        <label for="c-type" class="control-label col-xs-12 col-sm-2">{:__('Type')}:</label>
        <div class="col-xs-12 col-sm-4">
            <select name="row[type]" id="c-type" class="form-control selectpicker">
                {volist name="typeList" id="type"}
                <option value="{$key}">{$type}</option>
                {/volist}
                <option value="location">定位地点</option>
            </select>
        </div>
    </div>
    <div id="subtype" class="hidden">
        <div class="form-group hidden tf tf-images tf-files">
            <label for="c-selectpage-table" class="control-label col-xs-12 col-sm-2"></label>
            <div class="col-xs-12 col-sm-10">
                <div class="alert alert-danger-light" style="margin-bottom:0;">
                    温馨提示：<br>
                    1、建议将字段长度调整为1500或更高，否则可能出现图片过多时被截取的问题
                </div>
            </div>
        </div>
        <div class="form-group hidden tf tf-editor">
            <label for="c-selectpage-table" class="control-label col-xs-12 col-sm-2"></label>
            <div class="col-xs-12 col-sm-10">
                <div class="alert alert-danger-light" style="margin-bottom:0;">
                    温馨提示：<br>
                    1、请确保你已经正常安装富文本编辑器插件
                </div>
            </div>
        </div>
        <div class="form-group hidden tf tf-selectpage tf-selectpages">
            <label for="c-selectpage-table" class="control-label col-xs-12 col-sm-2"></label>
            <div class="col-xs-12 col-sm-10">
                <div class="alert alert-danger-light" style="margin-bottom:0;">
                    温馨提示：<br>
                    1、如果关联表有重要(隐私)数据，强烈不建议设定为关联表，以免造成信息泄漏<br>
                    2、如果关联表仅展示用户相关数据，请在筛选条件中 <code>user_id:{user_id}</code><br>
                    3、如果关联表存在<code>pid</code>字段，则可以在扩展信息中填写 <code>data-params='{"isTree":true}'</code>用于展示树状列表
                </div>
            </div>
        </div>
        <div class="form-group hidden tf tf-array">
            <label for="c-selectpage-table" class="control-label col-xs-12 col-sm-2"></label>
            <div class="col-xs-12 col-sm-10">
                <div class="alert alert-danger-light" style="margin-bottom:0;">
                    温馨提示：<br>
                    1、如果需要自定义数组展示标题，你可以输入键名标题和键值标题<br>
                    2、类型为数组时，验证规则只有 <code>必选</code>生效，其它规则均无效
                </div>
            </div>
        </div>
        <div class="form-group hidden tf tf-custom">
            <label for="c-selectpage-table" class="control-label col-xs-12 col-sm-2"></label>
            <div class="col-xs-12 col-sm-10">
                <div class="alert alert-danger-light" style="margin-bottom:0;">
                    温馨提示：<br>
                    1、如需要自定义展示数据，可以在扩展信息中输入你的HTML代码<br>
                    2、类型为自定义时，验证规则均无效
                </div>
            </div>
        </div>
        <div class="form-group hidden tf tf-number">
            <label for="c-decimals" class="control-label col-xs-12 col-sm-2">{:__('Decimals')}:</label>
            <div class="col-xs-12 col-sm-4">
                <input id="c-decimals" class="form-control" name="row[decimals]" type="number" value="0">
            </div>
        </div>
        <div class="form-group hidden tf tf-checkbox">
            <label for="c-minimum" class="control-label col-xs-12 col-sm-2">{:__('Minimum')}:</label>
            <div class="col-xs-12 col-sm-4">
                <input id="c-minimum" class="form-control" name="row[minimum]" type="number">
            </div>
        </div>
        <div class="form-group hidden tf tf-selects tf-images tf-files tf-checkbox">
            <label for="c-maximum" class="control-label col-xs-12 col-sm-2">{:__('Maximum')}:</label>
            <div class="col-xs-12 col-sm-4">
                <input id="c-maximum" class="form-control" name="row[maximum]" type="number">
            </div>
        </div>
        <div class="form-group hidden tf tf-selectpage tf-selectpages">
            <label for="c-selectpage-table" class="control-label col-xs-12 col-sm-2">{:__('Selectpage table')}:</label>
            <div class="col-xs-12 col-sm-4">
                <select id="c-selectpage-table" name="row[setting][table]" class="form-control selectpicker" data-live-search="true">
                    <option value="">{:__('Please select table')}</option>
                    {foreach name="tableList" id="item"}
                    <option value="{$key}" data-subtext="{$item}">{$key}</option>
                    {/foreach}
                </select>
            </div>
        </div>
        <div class="form-group hidden tf tf-selectpage tf-selectpages">
            <label for="c-selectpage-primarykey" class="control-label col-xs-12 col-sm-2">{:__('Selectpage primarykey')}:</label>
            <div class="col-xs-12 col-sm-4">
                <select name="row[setting][primarykey]" class="form-control selectpicker" id="c-selectpage-primarykey"></select>
            </div>
        </div>
        <div class="form-group hidden tf tf-selectpage tf-selectpages">
            <label for="c-selectpage-field" class="control-label col-xs-12 col-sm-2">{:__('Selectpage field')}:</label>
            <div class="col-xs-12 col-sm-4">
                <select name="row[setting][field]" class="form-control selectpicker" id="c-selectpage-field"></select>
            </div>
        </div>
        <div class="form-group hidden tf tf-selectpage tf-selectpages">
            <label class="control-label col-xs-12 col-sm-2">{:__('Selectpage conditions')}:</label>
            <div class="col-xs-12 col-sm-10">
                <table class="table fieldlist" data-template="selectpagetpl" data-name="row[setting][conditions]" id="selectpage-table">
                    <tr>
                        <td>{:__('筛选字段')}</td>
                        <td>{:__('操作符')}</td>
                        <td>{:__('筛选值')} <a href="javascript:" data-toggle="tooltip" data-title='支持{user_id}和{admin_id}占位替换'><i class="fa fa-info-circle"></i></a></td>
                        <td width="100"></td>
                    </tr>
                    <tr>
                        <td colspan="4"><a href="javascript:;" class="btn btn-sm btn-success btn-append"><i class="fa fa-plus"></i> {:__('Append')}</a></td>
                    </tr>
                </table>
                <textarea name="row[setting][conditions]" class="form-control hide" cols="30" rows="5">{$row.setting.conditions|default=''}</textarea>
            </div>
        </div>
        <div class="form-group hidden tf tf-array">
            <label for="c-array-key" class="control-label col-xs-12 col-sm-2">{:__('Array key')}:</label>
            <div class="col-xs-12 col-sm-4">
                <input type="text" name="row[setting][key]" class="form-control" id="c-array-key">
            </div>
        </div>
        <div class="form-group hidden tf tf-array">
            <label for="c-array-value" class="control-label col-xs-12 col-sm-2">{:__('Array value')}:</label>
            <div class="col-xs-12 col-sm-4">
                <input type="text" name="row[setting][value]" class="form-control" id="c-array-value">
            </div>
        </div>
        <div class="form-group hidden tf tf-select tf-selects tf-checkbox tf-radio tf-array">
            <label for="c-content" class="control-label col-xs-12 col-sm-2">{:__('Content')}:</label>
            <div class="col-xs-12 col-sm-8">
                <dl class="fieldlist" data-name="row[content]">
                    <dd>
                        <ins>{:__('Json key')}</ins>
                        <ins>{:__('Json value')}</ins>
                    </dd>
                    <dd><a href="javascript:;" class="btn btn-sm btn-success btn-append"><i class="fa fa-plus"></i> {:__('Append')}</a></dd>
                    <textarea id="c-content" data-rule="required" class="form-control hidden" name="row[content]">{"value1":"title1","value2":"title2"}</textarea>
                </dl>
            </div>
        </div>
    </div>
    <div class="form-group">
        <label for="c-defaultvalue" class="control-label col-xs-12 col-sm-2">{:__('Defaultvalue')}:</label>
        <div class="col-xs-12 col-sm-4">
            <input id="c-defaultvalue" class="form-control" name="row[defaultvalue]" type="text">
        </div>
    </div>
    <div class="form-group">
        <label for="c-defaultvalue" class="control-label col-xs-12 col-sm-2">{:__('Favisible')}:</label>
        <div class="col-xs-12 col-sm-10">
            <table class="table fieldlist" data-template="favisibletpl" data-name="row[favisible]" id="favisible-table">
                <tr>
                    <td>{:__('条件字段')}</td>
                    <td>{:__('操作符')}</td>
                    <td>{:__('条件值')} <a href="javascript:" data-toggle="tooltip" data-title='不支持{user_id}和{admin_id}占位替换'><i class="fa fa-info-circle text-danger"></i></a></td>
                    <td width="100"></td>
                </tr>
                <tr>
                    <td colspan="4"><a href="javascript:;" class="btn btn-sm btn-success btn-append"><i class="fa fa-plus"></i> {:__('Append')}</a></td>
                </tr>
            </table>
            <textarea name="row[favisible]" class="form-control hide" cols="30" rows="5"></textarea>
        </div>
    </div>
    <div class="form-group">
        <label for="c-rule" class="control-label col-xs-12 col-sm-2">{:__('Rule')}:</label>
        <div class="col-xs-12 col-sm-4">
            <input id="c-rule" class="form-control selectpage" data-source="miniform/fields/rulelist" data-multiple="true" name="row[rule]" type="text">
        </div>
    </div>
    <div class="form-group">
        <label for="c-msg" class="control-label col-xs-12 col-sm-2">{:__('Validate Msg')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-msg" class="form-control" name="row[msg]" type="text">
        </div>
    </div>
    <div class="form-group">
        <label for="c-ok" class="control-label col-xs-12 col-sm-2">{:__('Validate Ok')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-ok" class="form-control" name="row[ok]" type="text">
        </div>
    </div>
    <div class="form-group">
        <label for="c-tip" class="control-label col-xs-12 col-sm-2">{:__('Validate Tip')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-tip" class="form-control" name="row[tip]" type="text">
        </div>
    </div>
    <div class="form-group">
        <label for="c-length" class="control-label col-xs-12 col-sm-2">{:__('Length')}:</label>
        <div class="col-xs-12 col-sm-4">
            <input id="c-length" data-rule="required" class="form-control" name="row[length]" type="number" value="255">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Status')}:</label>
        <div class="col-xs-12 col-sm-8">

            <div class="radio">
                {foreach name="statusList" item="vo"}
                <label for="row[status]-{$key}"><input id="row[status]-{$key}" name="row[status]" type="radio" value="{$key}" {in name="key" value="normal" }checked{/in} /> {$vo}</label>
                {/foreach}
            </div>

        </div>
    </div>
    <div class="form-group layer-footer">
        <label class="control-label col-xs-12 col-sm-2"></label>
        <div class="col-xs-12 col-sm-8">
            <button type="submit" class="btn btn-primary btn-embossed disabled">{:__('OK')}</button>
            <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
        </div>
    </div>
</form>

{include file="miniform/common/conditions"}